package com.googlecode.ivybeans.facade;

import java.io.PrintWriter;
import org.apache.ivy.util.AbstractMessageLogger;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.MessageLogger;

public class SimpleIvyLogger extends AbstractMessageLogger implements MessageLogger {

    private PrintWriter out;
    private int level = Message.MSG_INFO;
    
    public SimpleIvyLogger(PrintWriter out) {
        this.out = out;
    }

    public void log(String msg, int level) {
        if (level <= this.level) {
            out.println(msg);
        }
    }

    public void rawlog(String msg, int level) {
        log(msg, level);
    }

    public void doProgress() {
        out.print(".");
    }

    public void doEndProgress(String msg) {
       out.println(msg);
    }

    public int getLevel() {
        return level;
    }
}
